package com.jc.ds.model;

import java.util.Date;

/**
 * pro_attribute
 * @author 
 */
public class ProAttribute extends BaseValueObject {
    private Long id;

    /**
     * 产品属性名称
     */
    private String productAttributeName;

    /**
     * 1 有效 0 禁用
     */
    private Integer isValid;

    /**
     * 添加时间
     */
    private Date createTime;

    private String orderStr = null;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getProductAttributeName() {
        return productAttributeName;
    }

    public void setProductAttributeName(String productAttributeName) {
        this.productAttributeName = productAttributeName;
    }

    public Integer getIsValid() {
        return isValid;
    }

    public void setIsValid(Integer isValid) {
        this.isValid = isValid;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public void orderById(boolean isAsc) {
        if(isAsc){
            if(this.orderStr == null){
                this.orderStr = "order by id asc";
            }else{
                this.orderStr = this.orderStr + ",id asc";
            }
        }else{
            if(this.orderStr == null){
                this.orderStr = "order by id desc";
            }else{
                this.orderStr = this.orderStr + ",id desc";
            }
        }
    }

    public void orderByProductAttributeName(boolean isAsc) {
        if(isAsc){
            if(this.orderStr == null){
                this.orderStr = "order by product_attribute_name asc";
            }else{
                this.orderStr = this.orderStr + ",product_attribute_name asc";
            }
        }else{
            if(this.orderStr == null){
                this.orderStr = "order by product_attribute_name desc";
            }else{
                this.orderStr = this.orderStr + ",product_attribute_name desc";
            }
        }
    }

    public void orderByIsValid(boolean isAsc) {
        if(isAsc){
            if(this.orderStr == null){
                this.orderStr = "order by is_valid asc";
            }else{
                this.orderStr = this.orderStr + ",is_valid asc";
            }
        }else{
            if(this.orderStr == null){
                this.orderStr = "order by is_valid desc";
            }else{
                this.orderStr = this.orderStr + ",is_valid desc";
            }
        }
    }

    public void orderByCreateTime(boolean isAsc) {
        if(isAsc){
            if(this.orderStr == null){
                this.orderStr = "order by create_time asc";
            }else{
                this.orderStr = this.orderStr + ",create_time asc";
            }
        }else{
            if(this.orderStr == null){
                this.orderStr = "order by create_time desc";
            }else{
                this.orderStr = this.orderStr + ",create_time desc";
            }
        }
    }
}